# Script to run QAP
library(sna)

# Load the followers adjacency matrix
y <- readRDS("processed_data/retweets_adjacencyMatrix.Rds")
# Load the predicting matrix 
load("processed_data/QAP_predicting_matrices_2.RData")

# Non Parallel implementation to run QAP
start.time <- Sys.time()
# Set seed value 
seed_value <- 47
set.seed(seed_value)
# Run netlm
qap_res <- netlm(y, predicting_matrices, reps = 5)
end.time <- Sys.time()
time.taken <- end.time - start.time
time.taken

# Save results 
file_name <- paste0("output/qap_res_retweets_out", seed_value, ".Rds")
saveRDS(qap_res, file=file_name)